import java.io.IOException;

import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;


public class XMLUtil {
	public static String serverIP;
	public static String serverPort;
	public static String clientIP;
	public static String clientPort;

	public static void fetchXML(){
		SAXBuilder sb = new SAXBuilder();
		try {
			Document doc = sb.build("configuration.xml");
			Element root = doc.getRootElement();
			Element server = root.getChild("server");
			Element ip = server.getChild("IP");
			Element port = server.getChild("Port");
			serverIP = ip.getValue();
			serverPort = port.getValue();
			server = root.getChild("client");
			ip = server.getChild("IP");
			port = server.getChild("Port");
			clientIP = ip.getValue();
			clientPort = port.getValue();
		} catch (JDOMException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
